home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume2 / window / part4 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  25.7 KB

  1. From: Tom Truscott <decvax!mcnc!rti-sel!trt>
  2. Subject: wm (part 4 of 4) - Patches to Curses
  3. Newsgroups: mod.sources
  4. Approved: john@genrad.UUCP
  5.  
  6. Mod.sources:  Volume 2, Issue 34
  7. Submitted by: Tom Truscott <decvax!mcnc!rti-sel!trt>
  8.  
  9.  
  10. #! /bin/sh
  11. # This is a shell archive, meaning:
  12. # 1. Remove everything above the #! /bin/sh line.
  13. # 2. Save the resulting text in a file.
  14. # 3. Execute the file with /bin/sh (not csh) to create the files:
  15. #    README.curses
  16. #    UPGRADE
  17. #    addch.c.pat
  18. #    clrtobot.c.pat
  19. #    cr_tty.c.pat
  20. #    curses.h.new
  21. #    deleteln.c.pat
  22. #    initscr.c.pat
  23. #    insertln.c.pat
  24. #    longname.c.new
  25. #    move.c.pat
  26. #    mvwin.c.pat
  27. #    newwin.c.pat
  28. #    overlay.c.pat
  29. #    printw.c.new
  30. #    refresh.c.pat
  31. #    tstp.c.new
  32. # This archive created: Fri Aug  2 13:33:10 1985
  33. export PATH; PATH=/bin:$PATH
  34. echo shar: extracting "'README.curses'" '(1005 characters)'
  35. if test -f 'README.curses'
  36. then
  37.     echo shar: will not over-write existing file "'README.curses'"
  38. else
  39. sed 's/^X//' << \SHAR_EOF > 'README.curses'
  40. XSAVE THIS KIT IF YOU WANT TO RUN THE 'WM' WINDOW MANAGER
  41.  
  42.     4.2 BSD libcurses patch kit
  43.     Tom Truscott, mcnc!rti-sel!trt
  44.     Research Triangle Institute, NC
  45.         (919) 541-7005
  46.  
  47. This is a collection of patches
  48. for the vanilla 4.2 BSD libcurses distribution.
  49. It includes some bug fixes reported on Usenet,
  50. some discovered locally, and some (but not all) of
  51. the fixes in the UCSF User Software Engineering distribution ("Troll").
  52. Tony Wassermann graciously permitted those to be included here.
  53.  
  54. It also includes some disgusting efficiency hacks.
  55.  
  56. To Install:
  57. *) Unpack this shar file in an empty directory.
  58. *) In 'UPGRADE', set the CURSRC variable to
  59.    the name of the *vanilla* 4.2 BSD libcurses sources.
  60. *) Make sure you have the wonderful 'patch' program.
  61.     (If you do not, do the patches yourself!)
  62. *) Run UPGRADE
  63. *) 'make' to compile libcurses and libcurses_p
  64. *) If you want to install this as the standard curses,
  65.     a) save the old curses.h and /usr/lib/libcur*
  66.     b) 'make install'
  67.     c) cp curses.h /usr/include
  68. SHAR_EOF
  69. if test 1005 -ne "`wc -c < 'README.curses'`"
  70. then
  71.     echo shar: error transmitting "'README.curses'" '(should have been 1005 characters)'
  72. fi
  73. fi # end of overwriting check
  74. echo shar: extracting "'UPGRADE'" '(573 characters)'
  75. if test -f 'UPGRADE'
  76. then
  77.     echo shar: will not over-write existing file "'UPGRADE'"
  78. else
  79. sed 's/^X//' << \SHAR_EOF > 'UPGRADE'
  80. #! /bin/sh
  81. CURSRC=/usr/src/usr.lib/libcurses
  82.  
  83. echo 'Copying in the 4.2 BSD libcurses'
  84. (cd $CURSRC; tar cf - .) | tar xvpf -
  85.  
  86. echo 'Replacing modules:'
  87. for i in *.new
  88. do
  89.     echo " $i"
  90.     mv `basename $i .new` `basename $i .new`.orig
  91.     cp $i `basename $i .new`
  92. done
  93. echo ' '
  94.  
  95. echo 'Patching modules:'
  96. for i in *.pat
  97. do
  98.     echo " $i"
  99.     patch `basename $i .pat` $i
  100. done
  101. echo ' '
  102.  
  103. echo 'Done'
  104.  
  105. echo 'To compile, "make"'
  106. echo 'To install, "make install"'
  107. echo '(But first save the old /usr/include/curses.h and /usr/lib/libcurs*)'
  108. echo 'To clean up, "make clean; rm *.orig *.new *.pat"'
  109. SHAR_EOF
  110. if test 573 -ne "`wc -c < 'UPGRADE'`"
  111. then
  112.     echo shar: error transmitting "'UPGRADE'" '(should have been 573 characters)'
  113. fi
  114. fi # end of overwriting check
  115. echo shar: extracting "'addch.c.pat'" '(1025 characters)'
  116. if test -f 'addch.c.pat'
  117. then
  118.     echo shar: will not over-write existing file "'addch.c.pat'"
  119. else
  120. sed 's/^X//' << \SHAR_EOF > 'addch.c.pat'
  121. *** libcurses42/addch.c    Thu Nov 17 11:03:10 1983
  122. --- libcurses/addch.c    Wed Jul 24 13:30:58 1985
  123. ***************
  124. *** 19,22
  125.   # endif
  126. !     if (y >= win->_maxy || x >= win->_maxx || y < 0 || x < 0)
  127. !         return ERR;
  128.       switch (c) {
  129.  
  130. --- 19,25 -----
  131.   # endif
  132. ! #ifdef slowway
  133. !     /* These tests 'cannot happen'.  What about win==NULL?! */
  134. !     if (y < 0 || y >= win->_maxy || x < 0 || x >= win->_maxx)
  135. !         return (ERR);
  136. ! #endif
  137.       switch (c) {
  138. ***************
  139. *** 38,40
  140.               c |= _STANDOUT;
  141. !         set_ch(win, y, x, c, NULL);
  142.           for (wp = win->_nextp; wp != win; wp = wp->_nextp)
  143.  
  144. --- 41,55 -----
  145.               c |= _STANDOUT;
  146. ! #ifdef    slowway
  147. !         set_ch(win, y, x, c, (WINDOW *)NULL);
  148. ! #else
  149. !         /* rti-sel!trt: efficiency hack */
  150. !         if (win->_y[y][x] != c) {
  151. !             if (win->_firstch[y] == _NOCHANGE)
  152. !                 win->_firstch[y] = win->_lastch[y] = x;
  153. !             else if (x > win->_lastch[y])
  154. !                 win->_lastch[y] = x;
  155. !             else if (x < win->_firstch[y])
  156. !                 win->_firstch[y] = x;
  157. !         }
  158. ! #endif
  159.           for (wp = win->_nextp; wp != win; wp = wp->_nextp)
  160. SHAR_EOF
  161. if test 1025 -ne "`wc -c < 'addch.c.pat'`"
  162. then
  163.     echo shar: error transmitting "'addch.c.pat'" '(should have been 1025 characters)'
  164. fi
  165. fi # end of overwriting check
  166. echo shar: extracting "'clrtobot.c.pat'" '(500 characters)'
  167. if test -f 'clrtobot.c.pat'
  168. then
  169.     echo shar: will not over-write existing file "'clrtobot.c.pat'"
  170. else
  171. sed 's/^X//' << \SHAR_EOF > 'clrtobot.c.pat'
  172. *** libcurses42/clrtobot.c    Thu Nov 17 11:03:12 1983
  173. --- libcurses/clrtobot.c    Wed Jul 24 13:29:44 1985
  174. ***************
  175. *** 3,5
  176.   /*
  177. !  *    This routine erases everything on the window.
  178.    *
  179.  
  180. --- 3,7 -----
  181.   /*
  182. !  *    This routine erases from the current position
  183. !  *    to the end of the window (inclusive).
  184. !  *    The current position remains unchanged.
  185.    *
  186. ***************
  187. *** 34,36
  188.       }
  189. !     win->_curx = win->_cury = 0;
  190.   }
  191.  
  192. --- 36,40 -----
  193.       }
  194. ! #ifdef    wantamess
  195. !     win->_curx=win->_cury=0;
  196. ! #endif
  197.   }
  198. SHAR_EOF
  199. if test 500 -ne "`wc -c < 'clrtobot.c.pat'`"
  200. then
  201.     echo shar: error transmitting "'clrtobot.c.pat'" '(should have been 500 characters)'
  202. fi
  203. fi # end of overwriting check
  204. echo shar: extracting "'cr_tty.c.pat'" '(339 characters)'
  205. if test -f 'cr_tty.c.pat'
  206. then
  207.     echo shar: will not over-write existing file "'cr_tty.c.pat'"
  208. else
  209. sed 's/^X//' << \SHAR_EOF > 'cr_tty.c.pat'
  210. *** libcurses42/cr_tty.c    Thu Nov 17 11:02:54 1983
  211. --- libcurses/cr_tty.c    Thu Mar 14 13:31:45 1985
  212. ***************
  213. *** 96,98
  214.       PC = xPC ? xPC[0] : FALSE;
  215. !     aoftspace = tspace;
  216.       strcpy(ttytype, longname(genbuf, type));
  217.  
  218. --- 96,98 -----
  219.       PC = xPC ? xPC[0] : FALSE;
  220. ! /*    aoftspace = tspace;*/
  221.       strcpy(ttytype, longname(genbuf, type));
  222. SHAR_EOF
  223. if test 339 -ne "`wc -c < 'cr_tty.c.pat'`"
  224. then
  225.     echo shar: error transmitting "'cr_tty.c.pat'" '(should have been 339 characters)'
  226. fi
  227. fi # end of overwriting check
  228. echo shar: extracting "'curses.h.new'" '(4778 characters)'
  229. if test -f 'curses.h.new'
  230. then
  231.     echo shar: will not over-write existing file "'curses.h.new'"
  232. else
  233. sed 's/^X//' << \SHAR_EOF > 'curses.h.new'
  234. /* @(#)curses.h    1.14 (Berkeley) 7/4/83 */
  235. /* Dec 83 Corrections made at University of California, San Francisco */
  236. # ifndef WINDOW
  237.  
  238. # include    <stdio.h>
  239.  
  240. # include    <sgtty.h>
  241. # include    <sys/ioctl.h>
  242.  
  243. # define    bool    char
  244. # define    reg    register
  245.  
  246. # define    TRUE    (1)
  247. # define    FALSE    (0)
  248. # define    ERR    (0)
  249. # define    OK    (1)
  250.  
  251. # define    _ENDLINE    001
  252. # define    _FULLWIN    002
  253. # define    _SCROLLWIN    004
  254. # define    _FLUSH        010
  255. # define    _STANDOUT    0200
  256. # define    _NOCHANGE    -1
  257.  
  258. # define    _puts(s)    tputs(s, 0, _putchar)
  259.  
  260. typedef    struct sgttyb    SGTTY;
  261.  
  262. /*
  263.  * Capabilities from termcap
  264.  */
  265.  
  266. extern bool     AM, BS, CA, DA, DB, EO, GT, HZ, IN, MI, MS, NC, OS, UL,
  267.         XN;
  268. extern char     *AL, *BC, *BT, *CD, *CE, *CL, *CM, *CR, *DC, *DL, *DM,
  269.         *DO, *ED, *EI, *HO, *IC, *IM, *IP, *LL, *MA, *ND, *NL,
  270.         *SE, *SF, *SO, *SR, *TA, *TE, *TI, *UC, *UE, *UP, *US,
  271.         *VB, *VE, *VS, PC;
  272.  
  273. /*
  274.  * From the tty modes...
  275.  */
  276.  
  277. extern bool    NONL, UPPERCASE, normtty, _pfast;
  278.  
  279. struct _win_st {
  280.     short        _cury, _curx;
  281.     short        _maxy, _maxx;
  282.     short        _begy, _begx;
  283.     short        _flags;
  284.     bool        _clear;
  285.     bool        _leave;
  286.     bool        _scroll;
  287.     char        **_y;
  288.     short        *_firstch;
  289.     short        *_lastch;
  290.     struct _win_st    *_nextp, *_orig;
  291. };
  292.  
  293. # define    WINDOW    struct _win_st
  294.  
  295. extern bool    My_term, _echoit, _rawmode, _endwin;
  296.  
  297. extern char    *Def_term, ttytype[];
  298.  
  299. extern int    LINES, COLS, _tty_ch, _res_flg;
  300.  
  301. extern SGTTY    _tty;
  302.  
  303. extern WINDOW    *stdscr, *curscr;
  304.  
  305. /*
  306.  *    Define VOID to stop lint from generating "null effect"
  307.  * comments.
  308.  */
  309. # ifdef lint
  310. int    __void__;
  311. # define    VOID(x)    (__void__ = (int) (x))
  312. # else
  313. # define    VOID(x)    (x)
  314. # endif
  315.  
  316. /*
  317.  * psuedo functions for standard screen
  318.  */
  319. # define    addch(ch)    VOID(waddch(stdscr, ch))
  320. # define    getch()        VOID(wgetch(stdscr))
  321. # define    addstr(str)    VOID(waddstr(stdscr, str))
  322. # define    getstr(str)    VOID(wgetstr(stdscr, str))
  323. # define    move(y, x)    VOID(wmove(stdscr, y, x))
  324. # define    clear()        VOID(wclear(stdscr))
  325. # define    erase()        VOID(werase(stdscr))
  326. # define    clrtobot()    VOID(wclrtobot(stdscr))
  327. # define    clrtoeol()    VOID(wclrtoeol(stdscr))
  328. # define    insertln()    VOID(winsertln(stdscr))
  329. # define    deleteln()    VOID(wdeleteln(stdscr))
  330. # define    refresh()    VOID(wrefresh(stdscr))
  331. # define    inch()        VOID(winch(stdscr))
  332. # define    insch(c)    VOID(winsch(stdscr,c))
  333. # define    delch()        VOID(wdelch(stdscr))
  334. # define    standout()    VOID(wstandout(stdscr))
  335. # define    standend()    VOID(wstandend(stdscr))
  336.  
  337. /*
  338.  * mv functions
  339.  */
  340. #define    mvwaddch(win,y,x,ch)    VOID(wmove(win,y,x)==ERR?ERR:waddch(win,ch))
  341. #define    mvwgetch(win,y,x)    VOID(wmove(win,y,x)==ERR?ERR:wgetch(win))
  342. #define    mvwaddstr(win,y,x,str)    VOID(wmove(win,y,x)==ERR?ERR:waddstr(win,str))
  343. #define mvwgetstr(win,y,x,str)  VOID(wmove(win,y,x)==ERR?ERR:wgetstr(win,str))
  344. #define    mvwinch(win,y,x)    VOID(wmove(win,y,x) == ERR ? ERR : winch(win))
  345. #define    mvwdelch(win,y,x)    VOID(wmove(win,y,x) == ERR ? ERR : wdelch(win))
  346. #define    mvwinsch(win,y,x,c)    VOID(wmove(win,y,x) == ERR ? ERR:winsch(win,c))
  347. #define    mvaddch(y,x,ch)        mvwaddch(stdscr,y,x,ch)
  348. #define    mvgetch(y,x)        mvwgetch(stdscr,y,x)
  349. #define    mvaddstr(y,x,str)    mvwaddstr(stdscr,y,x,str)
  350. #define mvgetstr(y,x,str)       mvwgetstr(stdscr,y,x,str)
  351. #define    mvinch(y,x)        mvwinch(stdscr,y,x)
  352. #define    mvdelch(y,x)        mvwdelch(stdscr,y,x)
  353. #define    mvinsch(y,x,c)        mvwinsch(stdscr,y,x,c)
  354.  
  355. /*
  356.  * psuedo functions
  357.  */
  358.  
  359. #define    clearok(win,bf)     (win->_clear = bf)
  360. #define    leaveok(win,bf)     (win->_leave = bf)
  361. #define    scrollok(win,bf) (win->_scroll = bf)
  362. #define flushok(win,bf)     (bf ? (win->_flags |= _FLUSH):(win->_flags &= ~_FLUSH))
  363. #define    getyx(win,y,x)     y = win->_cury, x = win->_curx
  364. #define    winch(win)     (win->_y[win->_cury][win->_curx] & 0177)
  365.  
  366. #define raw()     (_tty.sg_flags|=RAW, _pfast=_rawmode=TRUE, ioctl(_tty_ch,TIOCSETN,(char *)&_tty))
  367. #define noraw()     (_tty.sg_flags&=~RAW,_rawmode=FALSE,_pfast=!(_tty.sg_flags&CRMOD),ioctl(_tty_ch,TIOCSETN,(char *)&_tty))
  368. #define crmode() (_tty.sg_flags |= CBREAK, _rawmode = TRUE, ioctl(_tty_ch,TIOCSETN,(char *)&_tty))
  369. #define nocrmode() (_tty.sg_flags &= ~CBREAK,_rawmode=FALSE,ioctl(_tty_ch,TIOCSETN,(char *)&_tty))
  370. #define echo()     (_tty.sg_flags |= ECHO, _echoit = TRUE, ioctl(_tty_ch,TIOCSETN,(char *)&_tty))
  371. #define noecho() (_tty.sg_flags &= ~ECHO, _echoit = FALSE, ioctl(_tty_ch,TIOCSETN,(char *)&_tty))
  372. /* nl(), nonl() fixed by Mike Lilley and Mike Laman */
  373. #define nl()     (_tty.sg_flags |= CRMOD,_pfast = _tty.sg_flags&RAW,NONL=FALSE,ioctl(_tty_ch,TIOCSETN,(char *)&_tty))
  374. #define nonl()     (_tty.sg_flags &= ~CRMOD, _pfast = TRUE,NONL=TRUE, ioctl(_tty_ch,TIOCSETN,(char *)&_tty))
  375. #define    savetty() ((void)gtty(_tty_ch,&_tty), _res_flg = _tty.sg_flags)
  376. #define    resetty() (_tty.sg_flags = _res_flg, ioctl(_tty_ch,TIOCSETN,(char *)&_tty))
  377.  
  378. WINDOW    *initscr(), *newwin(), *subwin();
  379. char    *longname(), *getcap();
  380.  
  381. /*
  382.  * Used to be in unctrl.h.
  383.  */
  384. #define    unctrl(c)    _unctrl[(c) & 0177]
  385. extern char *_unctrl[];
  386. # endif
  387. SHAR_EOF
  388. if test 4778 -ne "`wc -c < 'curses.h.new'`"
  389. then
  390.     echo shar: error transmitting "'curses.h.new'" '(should have been 4778 characters)'
  391. fi
  392. fi # end of overwriting check
  393. echo shar: extracting "'deleteln.c.pat'" '(361 characters)'
  394. if test -f 'deleteln.c.pat'
  395. then
  396.     echo shar: will not over-write existing file "'deleteln.c.pat'"
  397. else
  398. sed 's/^X//' << \SHAR_EOF > 'deleteln.c.pat'
  399. *** libcurses42/deleteln.c    Thu Nov 17 11:02:56 1983
  400. --- libcurses/deleteln.c    Sat Jul  6 14:14:20 1985
  401. ***************
  402. *** 24,25
  403.       win->_y[win->_maxy-1] = temp - win->_maxx;
  404.   }
  405.  
  406. --- 24,27 -----
  407.       win->_y[win->_maxy-1] = temp - win->_maxx;
  408. +     win->_firstch[win->_maxy-1] = 0;    /* Mike Laman (?) */
  409. +     win->_lastch[win->_maxy-1] = win->_maxx -1;    /* ditto */
  410.   }
  411. SHAR_EOF
  412. if test 361 -ne "`wc -c < 'deleteln.c.pat'`"
  413. then
  414.     echo shar: error transmitting "'deleteln.c.pat'" '(should have been 361 characters)'
  415. fi
  416. fi # end of overwriting check
  417. echo shar: extracting "'initscr.c.pat'" '(485 characters)'
  418. if test -f 'initscr.c.pat'
  419. then
  420.     echo shar: will not over-write existing file "'initscr.c.pat'"
  421. else
  422. sed 's/^X//' << \SHAR_EOF > 'initscr.c.pat'
  423. *** libcurses42/initscr.c    Thu Nov 17 11:03:00 1983
  424. --- libcurses/initscr.c    Sun Jul 21 17:59:02 1985
  425. ***************
  426. *** 15,16
  427.       reg char    *sp;
  428.       int        tstp();
  429.  
  430. --- 15,17 -----
  431.       reg char    *sp;
  432. +     int        (*oldtstp)();    /* Ron Wessels, uthub.149, May 1984 */
  433.       int        tstp();
  434. ***************
  435. *** 41,43
  436.   # ifdef SIGTSTP
  437. !     signal(SIGTSTP, tstp);
  438.   # endif
  439.  
  440. --- 42,45 -----
  441.   # ifdef SIGTSTP
  442. !     if ((oldtstp = signal(SIGTSTP, tstp)) != SIG_DFL)
  443. !         (void) signal(SIGTSTP, oldtstp);
  444.   # endif
  445. SHAR_EOF
  446. if test 485 -ne "`wc -c < 'initscr.c.pat'`"
  447. then
  448.     echo shar: error transmitting "'initscr.c.pat'" '(should have been 485 characters)'
  449. fi
  450. fi # end of overwriting check
  451. echo shar: extracting "'insertln.c.pat'" '(242 characters)'
  452. if test -f 'insertln.c.pat'
  453. then
  454.     echo shar: will not over-write existing file "'insertln.c.pat'"
  455. else
  456. sed 's/^X//' << \SHAR_EOF > 'insertln.c.pat'
  457. *** libcurses42/insertln.c    Thu Nov 17 11:03:01 1983
  458. --- libcurses/insertln.c    Sat Jul  6 14:12:54 1985
  459. ***************
  460. *** 34,35
  461.               return ERR;
  462.       return OK;
  463.  
  464. --- 34,36 -----
  465.               return ERR;
  466. +     touchwin(win);    /* Mike Laman */
  467.       return OK;
  468. SHAR_EOF
  469. if test 242 -ne "`wc -c < 'insertln.c.pat'`"
  470. then
  471.     echo shar: error transmitting "'insertln.c.pat'" '(should have been 242 characters)'
  472. fi
  473. fi # end of overwriting check
  474. echo shar: extracting "'longname.c.new'" '(855 characters)'
  475. if test -f 'longname.c.new'
  476. then
  477.     echo shar: will not over-write existing file "'longname.c.new'"
  478. else
  479. sed 's/^X//' << \SHAR_EOF > 'longname.c.new'
  480. # define    reg    register
  481.  
  482. /*
  483.  *    This routine fills in "def" with the long name of the terminal.
  484.  *
  485.  * 1/26/81 (Berkeley) @(#)longname.c    1.1
  486.  *
  487.  * 2/22/84 Corrections made at University of California, San Francisco.
  488.  * This correction makes a private copy of the longname. The original version
  489.  * simply patched a '\0' in the termcap buffer, preventing access to
  490.  * terminal capabilities at a later point.
  491.  * rti-sel!trt: note: this code is still broken wrt the documentation.
  492.  * It operates confusingly and usually gets the wrong answer.
  493.  */
  494.  
  495. char *
  496. longname(bp, def)
  497. reg char    *bp, *def; {
  498.  
  499.     reg char    *cp;
  500.     static char longcopy[30] ;
  501.  
  502.     while (*bp && *bp != ':' && *bp != '|')
  503.         bp++;
  504.     if (*bp == '|') {
  505.         bp++;
  506.         cp = longcopy ;
  507.         while ((cp-longcopy)<29 && *bp && *bp != ':' && *bp != '|')
  508.             *cp++ = *bp++ ;
  509.         *cp = 0;
  510.         return longcopy;
  511.     }
  512.     return def;
  513. }
  514. SHAR_EOF
  515. if test 855 -ne "`wc -c < 'longname.c.new'`"
  516. then
  517.     echo shar: error transmitting "'longname.c.new'" '(should have been 855 characters)'
  518. fi
  519. fi # end of overwriting check
  520. echo shar: extracting "'move.c.pat'" '(312 characters)'
  521. if test -f 'move.c.pat'
  522. then
  523.     echo shar: will not over-write existing file "'move.c.pat'"
  524. else
  525. sed 's/^X//' << \SHAR_EOF > 'move.c.pat'
  526. *** libcurses42/move.c    Thu Nov 17 11:03:14 1983
  527. --- libcurses/move.c    Wed Jul 24 13:25:47 1985
  528. ***************
  529. *** 14,15
  530.   # endif
  531.       if (x >= win->_maxx || y >= win->_maxy)
  532.  
  533. --- 14,19 -----
  534.   # endif
  535. + #ifndef wantamess
  536. +     if (x < 0 || y < 0)
  537. +         return(ERR);
  538. + #endif
  539.       if (x >= win->_maxx || y >= win->_maxy)
  540. SHAR_EOF
  541. if test 312 -ne "`wc -c < 'move.c.pat'`"
  542. then
  543.     echo shar: error transmitting "'move.c.pat'" '(should have been 312 characters)'
  544. fi
  545. fi # end of overwriting check
  546. echo shar: extracting "'mvwin.c.pat'" '(309 characters)'
  547. if test -f 'mvwin.c.pat'
  548. then
  549.     echo shar: will not over-write existing file "'mvwin.c.pat'"
  550. else
  551. sed 's/^X//' << \SHAR_EOF > 'mvwin.c.pat'
  552. *** libcurses42/mvwin.c    Thu Nov 17 11:03:03 1983
  553. --- libcurses/mvwin.c    Wed May 30 22:23:12 1984
  554. ***************
  555. *** 12,14
  556.   
  557. !     if (by + win->_maxy > LINES || bx + win->_maxx > COLS)
  558.           return ERR;
  559.  
  560. --- 12,14 -----
  561.   
  562. !     if (by + win->_maxy > LINES || bx + win->_maxx > COLS || by<0 || bx<0)
  563.           return ERR;
  564. SHAR_EOF
  565. if test 309 -ne "`wc -c < 'mvwin.c.pat'`"
  566. then
  567.     echo shar: error transmitting "'mvwin.c.pat'" '(should have been 309 characters)'
  568. fi
  569. fi # end of overwriting check
  570. echo shar: extracting "'newwin.c.pat'" '(336 characters)'
  571. if test -f 'newwin.c.pat'
  572. then
  573.     echo shar: will not over-write existing file "'newwin.c.pat'"
  574. else
  575. sed 's/^X//' << \SHAR_EOF > 'newwin.c.pat'
  576. *** libcurses42/newwin.c    Thu Nov 17 11:03:02 1983
  577. --- libcurses/newwin.c    Wed Jul 24 13:27:23 1985
  578. ***************
  579. *** 117,118
  580.   
  581.   # ifdef    DEBUG
  582.  
  583. --- 117,125 -----
  584.   
  585. + #ifndef wantamess
  586. +     if (by < 0 || bx < 0 || nl <= 0 || nc <= 0)
  587. +         return(NULL);
  588. +     if (by+nl > LINES || bx+nc > COLS)
  589. +         return(NULL);
  590. + #endif
  591.   # ifdef    DEBUG
  592. SHAR_EOF
  593. if test 336 -ne "`wc -c < 'newwin.c.pat'`"
  594. then
  595.     echo shar: error transmitting "'newwin.c.pat'" '(should have been 336 characters)'
  596. fi
  597. fi # end of overwriting check
  598. echo shar: extracting "'overlay.c.pat'" '(413 characters)'
  599. if test -f 'overlay.c.pat'
  600. then
  601.     echo shar: will not over-write existing file "'overlay.c.pat'"
  602. else
  603. sed 's/^X//' << \SHAR_EOF > 'overlay.c.pat'
  604. *** libcurses42/overlay.c    Thu Nov 17 11:03:04 1983
  605. --- libcurses/overlay.c    Sat Jul  6 14:13:04 1985
  606. ***************
  607. *** 24,26
  608.       endx = min(win1->_maxx, win2->_maxx) - win1->_begx - 1;
  609. !     for (y = starty; y < endy; y++) {
  610.           end = &win1->_y[y][endx];
  611.  
  612. --- 24,26 -----
  613.       endx = min(win1->_maxx, win2->_maxx) - win1->_begx - 1;
  614. !     for (y = starty; y <= endy; y++) {    /* Mike Laman */
  615.           end = &win1->_y[y][endx];
  616. SHAR_EOF
  617. if test 413 -ne "`wc -c < 'overlay.c.pat'`"
  618. then
  619.     echo shar: error transmitting "'overlay.c.pat'" '(should have been 413 characters)'
  620. fi
  621. fi # end of overwriting check
  622. echo shar: extracting "'printw.c.new'" '(1849 characters)'
  623. if test -f 'printw.c.new'
  624. then
  625.     echo shar: will not over-write existing file "'printw.c.new'"
  626. else
  627. sed 's/^X//' << \SHAR_EOF > 'printw.c.new'
  628. /*
  629.  * printw and friends
  630.  *
  631.  * 1/26/81 (Berkeley) @(#)printw.c    1.1
  632.  */
  633.  
  634. # include    "curses.ext"
  635.  
  636. /*
  637.  *    This routine implements a printf on the standard screen.
  638.  *    
  639.  *    Modified by David Owen, U.C.S.D. 10.5.83 to allow arbitrary
  640.  *    length strings to "printw". In "sprintw" the error status is 
  641.  *    checked on return from the "doprnt" and if set, the
  642.  *    call is repeated with a bigger buffer.
  643.  */
  644. printw(fmt, args)
  645. char    *fmt;
  646. int    args; {
  647.  
  648.     return _sprintw(stdscr, fmt, &args);
  649. }
  650.  
  651. /*
  652.  *    This routine implements a printf on the given window.
  653.  */
  654. wprintw(win, fmt, args)
  655. WINDOW    *win;
  656. char    *fmt;
  657. int    args; {
  658.  
  659.     return _sprintw(win, fmt, &args);
  660. }
  661. /*
  662.  *    This routine actually executes the printf and adds it to the window
  663.  *
  664.  *    This is really a modified version of "sprintf".  As such,
  665.  * it assumes that sprintf interfaces with the other printf functions
  666.  * in a certain way.  If this is not how your system works, you
  667.  * will have to modify this routine to use the interface that your
  668.  * "sprintf" uses.
  669.  */
  670. _sprintw(win, fmt, args)
  671. WINDOW    *win;
  672. char    *fmt;
  673. int    *args; {
  674.  
  675.     FILE    junk;
  676.     char    buf[BUFSIZ],*bptr;
  677.     int count,res;
  678.     count = 0;
  679.  
  680.     junk._flag = _IOWRT + _IOSTRG;
  681.     junk._ptr = buf;
  682.     junk._base = buf;
  683.     junk._cnt = BUFSIZ;
  684. /*Make sure error flag set if ever "flsbuf" is called*/
  685.     junk._file = -1;
  686.     for(;;){
  687.         _doprnt(fmt, args, &junk);
  688.         putc('\0', &junk);
  689. /*If there was a write error increase buffer and try again*/
  690.         if(junk._flag & _IOERR){
  691.             if(count) 
  692.                 free(bptr);
  693.             else
  694.                 count = BUFSIZ;
  695.             count += BUFSIZ;
  696.             if((bptr = (char *)malloc(count)) == NULL){
  697.                 fprintf(stderr,"sprintw:no malloc space\n");
  698.                 return(-1);
  699.             }
  700.             junk._flag = _IOWRT + _IOSTRG;
  701.             junk._ptr = bptr;
  702.             junk._base = bptr;
  703.             junk._cnt = count;
  704.             junk._file = -1;
  705.             continue;
  706.         }
  707.         res = waddstr(win,junk._base);
  708.         if(count) free(bptr);
  709.         return(res);
  710.     }
  711. }
  712.  
  713. SHAR_EOF
  714. if test 1849 -ne "`wc -c < 'printw.c.new'`"
  715. then
  716.     echo shar: error transmitting "'printw.c.new'" '(should have been 1849 characters)'
  717. fi
  718. fi # end of overwriting check
  719. echo shar: extracting "'refresh.c.pat'" '(4884 characters)'
  720. if test -f 'refresh.c.pat'
  721. then
  722.     echo shar: will not over-write existing file "'refresh.c.pat'"
  723. else
  724. sed 's/^X//' << \SHAR_EOF > 'refresh.c.pat'
  725. *** libcurses42/refresh.c    Thu Nov 17 11:03:06 1983
  726. --- libcurses/refresh.c    Tue Jul 30 23:16:01 1985
  727. ***************
  728. *** 5,6
  729.    * 5/12/83 (Berkeley) @(#)refresh.c    1.8
  730.    */
  731.  
  732. --- 5,14 -----
  733.    * 5/12/83 (Berkeley) @(#)refresh.c    1.8
  734. +  *
  735. +  * 2/28/84 Correction at UCSF:
  736. +  * Take the terminal out of standout mode, before clear to end of line
  737. +  * if it isn't safe to move in standout mode (termcap entry ms)
  738. +  *
  739. +  * 3/14/85 Corrections at RTI
  740. +  *  Fix problems reported on Usenet.  Also, delete apparently
  741. +  *  useless (and harmful) code if _leave has been set.
  742.    */
  743. ***************
  744. *** 86,87
  745.           curscr->_curx = lx;
  746.           ly -= win->_begy;
  747.  
  748. --- 94,97 -----
  749.           curscr->_curx = lx;
  750. + #ifdef    wantamess
  751. +         /* rti-sel!trt: this code is completely bogus, yes? */
  752.           ly -= win->_begy;
  753. ***************
  754. *** 94,95
  755.               win->_cury = win->_curx = 0;
  756.       }
  757.  
  758. --- 104,106 -----
  759.               win->_cury = win->_curx = 0;
  760. + #endif
  761.       }
  762. ***************
  763. *** 118,119
  764.       reg int        nlsp, clsp;    /* last space in lines        */
  765.   
  766.  
  767. --- 129,131 -----
  768.       reg int        nlsp, clsp;    /* last space in lines        */
  769. +     static int glitchXN;
  770.   
  771. ***************
  772. *** 128,129
  773.       if (CE && !curwin) {
  774.           for (ce = &win->_y[wy][win->_maxx - 1]; *ce == ' '; ce--)
  775.  
  776. --- 140,142 -----
  777.       if (CE && !curwin) {
  778. + #ifdef slowway
  779.           for (ce = &win->_y[wy][win->_maxx - 1]; *ce == ' '; ce--)
  780. ***************
  781. *** 132,133
  782.           nlsp = ce - win->_y[wy];
  783.       }
  784.  
  785. --- 145,149 -----
  786.           nlsp = ce - win->_y[wy];
  787. + #else
  788. +         nlsp = -1;
  789. + #endif
  790.       }
  791. ***************
  792. *** 139,140
  793.           if (*nsp != *csp) {
  794.               domvcur(ly, lx, y, wx + win->_begx);
  795.  
  796. --- 155,168 -----
  797.           if (*nsp != *csp) {
  798. + #ifndef wantamess
  799. +             /* this is no guarantee, but seems to work */
  800. +             if (glitchXN && wx && wx+win->_begx==COLS-1) {
  801. +                 domvcur(ly, lx, y, wx+win->_begx-1);
  802. +                 ly = y;
  803. +                 lx = wx+win->_begx-1;
  804. +                 glitchXN = 0;
  805. +                 continue;
  806. +             }
  807. +             glitchXN = 0;
  808. + #endif
  809. + #ifdef slowway
  810.               domvcur(ly, lx, y, wx + win->_begx);
  811. ***************
  812. *** 145,147
  813.               lx = wx + win->_begx;
  814. !             while (*nsp != *csp && wx <= lch) {
  815.                   if (ce != NULL && wx >= nlsp && *nsp == ' ') {
  816.  
  817. --- 173,212 -----
  818.               lx = wx + win->_begx;
  819. ! #else
  820. !             /* speed hacks to avoid domvcur in simple cases */
  821. !             clsp = wx + win->_begx; /* dirty use of clsp */
  822. !             if (ly == y) {
  823. !                 if (lx == clsp)
  824. !                 goto at_target;
  825. !                 if (lx+1 == clsp && !curwin) {
  826. !                 /* enter/exit standout mode as appropriate */
  827. !                 if (SO && (csp[-1]&_STANDOUT) != (curscr->_flags&_STANDOUT)) {
  828. !                     if (csp[-1] & _STANDOUT) {
  829. !                         _puts(SO);
  830. !                         curscr->_flags |= _STANDOUT;
  831. !                     }
  832. !                     else {
  833. !                         _puts(SE);
  834. !                         curscr->_flags &= ~_STANDOUT;
  835. !                     }
  836. !                 }
  837. !                 putchar(csp[-1]&0177);
  838. !                 lx++;
  839. !                 goto at_target;
  840. !                 }
  841. !                 if (clsp == 0 && !(curscr->_flags&_STANDOUT)
  842. !                  && !NC && (!CR || CR[1] == '\0')) {
  843. !                 if (CR)
  844. !                     putchar(*CR);
  845. !                 else
  846. !                     putchar('\r');
  847. !                 lx = 0;
  848. !                 goto at_target;
  849. !                 }
  850. !             }
  851. !             domvcur(ly, lx, y, clsp);
  852. !             ly = y;
  853. !             lx = clsp;
  854. !         at_target:;
  855. ! #endif
  856. !             while (wx <= lch && *nsp != *csp) {
  857.                   if (ce != NULL && wx >= nlsp && *nsp == ' ') {
  858. ***************
  859. *** 147,148
  860.                   if (ce != NULL && wx >= nlsp && *nsp == ' ') {
  861.                       /*
  862.  
  863. --- 212,222 -----
  864.                   if (ce != NULL && wx >= nlsp && *nsp == ' ') {
  865. + #ifndef slowway
  866. +                     if (nlsp < 0) {
  867. +                     for (nlsp = win->_maxx-1;
  868. +                         nlsp > 0 && win->_y[wy][nlsp]==' ';
  869. +                         nlsp--)
  870. +                         ;
  871. +                     continue; /* gotta recheck nlsp */
  872. +                     }
  873. + #endif
  874.                       /*
  875. ***************
  876. *** 163,164
  877.   # endif
  878.                           _puts(CE);
  879.  
  880. --- 237,245 -----
  881.   # endif
  882. +                         /* if we shouldn't move in standout mode, CE may cause
  883. +                            problems too
  884. +                         */
  885. +                         if (curscr->_flags & _STANDOUT && !MS) {
  886. +                             _puts(SE);
  887. +                             curscr->_flags &= ~_STANDOUT;
  888. +                         }
  889.                           _puts(CE);
  890. ***************
  891. *** 226,228
  892.           else if (wx < lch)
  893. !             while (*nsp == *csp) {
  894.                   nsp++;
  895.  
  896. --- 307,309 -----
  897.           else if (wx < lch)
  898. !             while (wx <= lch && *nsp == *csp) {
  899.                   nsp++;
  900. ***************
  901. *** 239,240
  902.   ret:
  903.       return OK;
  904.  
  905. --- 320,346 -----
  906.   ret:
  907. + #ifndef    wantamess
  908. +     /* rti-sel!trt: update cursor location on auto-wrap */
  909. +     if (lx >= COLS) {
  910. +         if (XN) {    /* make this case like the usual one */
  911. +             if (curscr->_flags & _STANDOUT && !MS) {
  912. +                 _puts(SE);
  913. +                 curscr->_flags &= ~_STANDOUT;
  914. +             }
  915. +             putchar('\r');
  916. +             putchar('\n');
  917. +             glitchXN++;    /* next char must not be in col 80 */
  918. +         }
  919. +         lx = 0;
  920. +         if (ly < LINES-1)
  921. +             ly++;
  922. +         else {
  923. +             /* at this point the current screen scrolled up.
  924. +              * scroll() is strange, so we simulate it by hand.
  925. +              * Curses should probably not put anything in lower
  926. +              * right corner of screen, and thus avoid this mess */
  927. +             wmove(curscr, 0, 0); wdeleteln(curscr);
  928. +             wmove(curscr, ly, lx);
  929. +         }
  930. +     }
  931. + #endif
  932.       return OK;
  933. SHAR_EOF
  934. if test 4884 -ne "`wc -c < 'refresh.c.pat'`"
  935. then
  936.     echo shar: error transmitting "'refresh.c.pat'" '(should have been 4884 characters)'
  937. fi
  938. fi # end of overwriting check
  939. echo shar: extracting "'tstp.c.new'" '(841 characters)'
  940. if test -f 'tstp.c.new'
  941. then
  942.     echo shar: will not over-write existing file "'tstp.c.new'"
  943. else
  944. sed 's/^X//' << \SHAR_EOF > 'tstp.c.new'
  945. # include    <signal.h>
  946.  
  947. # include    "curses.ext"
  948.  
  949. /*
  950.  * handle stop and start signals
  951.  *
  952.  * 6/25/83 (Berkeley) @(#)tstp.c    1.3
  953.  */
  954. tstp() {
  955.  
  956. # ifdef SIGTSTP
  957.  
  958.     int ttyflags;
  959.     int    omask;
  960. # ifdef DEBUG
  961.     if (outf)
  962.         fflush(outf);
  963. # endif
  964.     ttyflags = _tty.sg_flags;    /* store curses state */
  965.     mvcur(0, COLS - 1, LINES - 1, 0);
  966.     endwin();
  967.     fflush(stdout);
  968.     /* reset signal handler so kill below stops us */
  969.     signal(SIGTSTP, SIG_DFL);
  970. #define    mask(s)    (1 << ((s)-1))
  971.     omask = sigsetmask(sigblock(0) &~ mask(SIGTSTP));
  972.     kill(0, SIGTSTP);
  973.     /* pc stops here */
  974.     /* okay, we started up again. */
  975.     sigsetmask(omask);
  976.     signal(SIGTSTP, tstp);
  977.     savetty();    /* re-remember the virgin state */
  978.     _tty.sg_flags = ttyflags;    /* restore special curses state */
  979.     ioctl(_tty_ch, TIOCSETN, &_tty);
  980.     _puts(TI); /* should we do VS too? */
  981.     wrefresh(curscr);
  982. # endif    SIGTSTP
  983. }
  984. SHAR_EOF
  985. if test 841 -ne "`wc -c < 'tstp.c.new'`"
  986. then
  987.     echo shar: error transmitting "'tstp.c.new'" '(should have been 841 characters)'
  988. fi
  989. fi # end of overwriting check
  990. #    End of shell archive
  991. exit 0
  992.